<?php 
/**
* EasySEF - SEF component for Joostina CMS.
* @author:      Лаборатория сайтов, http://sitelab.net.ru
* @version:     1.1
* @release:     2010.01.07
* @package:     com_sef
* @copyright:   (C) 2010 http://sitelab.net.ru, see /administrator/components/com_sef/copyright.php
* @license:     http://www.gnu.org/copyleft/gpl.html GNU/GPL
*
* Cоздан на базе sh404SEF  (C) 2007 by Yannick Gaultier
**/

defined( '_VALID_MOS' ) or die('');

?>
<style type="text/css">
    div.docs,
    div.docs p,
    div.docs ul li,
    div.docs ol li {
        text-align: left;
        font-weight: lighter;
        font-family: Tahoma, Arial, Verdana;
    }
    div.docs h1 {
        text-align: center;
    }
	div.docs h4,
	span.h4 {
		color: #CC0000;
	}
	div.docs p {
		padding-left: 3em;
		font-weight: lighter;
	}
	div.docs .small {
	    color: #666666;
		font-size: 90%;
	}
	div.docs h5, span.h5 {
        font-weight: bold;
    }
</style>
<div class="docs">
    <p style="text-align: right;"><span class="small">Updated: January 07, 2010</span></p>
    <h1><img src="components/com_sef/images/easysef-logo-big.png" align="middle" alt="easysef" title="easysef logo" border="0" />Документация EasySEF</h1>
    <p style="text-align: center;">for Joostina CMS 1.3</p>
    <h2>Сайты поддержки</h2>
    <br />
    Вы найдете свежую информацию и поддержку на <a href="http://joomlaforum.ru/index.php/topic,99217.0.html" target="_blank">форуме</a> и на сайте <a href="http://sitelab.net.ru" target="_blank">Лаборатория сайтов</a>. Пожалуйста, прочитайте также ответы на часто задаваемые вопросы. Это первое, что нужно сделать, если что-то не работает так, как вам бы хотелось.<br /><br />
    <h2>Коротко</h2>
    <p><span class=h5>Позволяет создавать дружественные поисковым системам адреса страниц для сервера Apache</strong> (и, возможно, но не гарантируется, IIS). Вы также можете настроить свой, пользовательский URL, если вас не устраивает автоматически созданный. Генерирует заголовок страницы и мета-теги, и вставляет их в страницу. Название и теги можно также установить вручную. Предоставляет функции безопасности, проверяя содержание URL и IP посетителя с различными списками служб контроля безопасности, а также противостоит флуду (переполнению памяти) системы.</p>
        <p>EasySEF работает с <span class=h5>Joomfish</span>, и имеет несколько плагинов для построения ЧПУ URL для различных компонентов, включая <span class=h5>JoosMart, Fireboard, Community Builder, Myblog, iJoomla Magazine and NewsPortal, Mosets Tree and Hot Property, и др.</span> Если вы используете Joomfish, посмотрите в конце документа заплатку для Joomfish, разрешающую перевод псевдонимов элементов контента. Если вы используете Virtuemart, посмотрите в конце документа примечание, где вы найдете несколько заплаток для Virtuemart 1.0.10: одну для работы с Joomfish (создана на форуме Virtuemart), другие позволяют совершать операции, используя SSL режим (взято с <a href="http://www.netshinesoftware.com">NetshineSoftware</a>).</p>
        <p>Компонент имеет систему кэширования, позволяющую сократить запросы к базам данных и повысить время загрузки страницы при использовании ЧПУ URL.</p>
        <p>EasySEF может работать <span class=h5> с или без mod_rewrite </span> (то есть с или без .htaccess файла). URL создаются те же, за исключением присутствия в них /index.php/, когда не используются .htaccess. Теперь это значение по умолчанию, что намного проще в использовании. Вы можете настроить обработчик ErrorDocument, тогда 404 ошибки больше не будут обрабатываться Joostina при работе без .htaccess файла.</p>
        <p>Интегрированный инструмент для управления мета-тегами, <span class=h5>shCustomTags</span> представляет собой модуль, который будет переписывать название, описание, ключевые слова, мета-теги "роботы"  и язык по вашему вкусу, на любой странице вашего сайта. Он имеет систему плагинов для размещения какого-либо компонента, в том числе JoosMart и постоянного плагина для контента, автоматически генерирующего эти теги. Плюс, вы сможете вручную установить любые теги на каждую страницу (страница распознается по URL). Более того, вы сможете обрамлять название материала тегом h1, а также удалить тег Generator, а также выполнять различные операции по замене текста на странице.</p>
        <p>Эти функции работают без вмешательство в код Joostina, просто как модуль. shCustomTags был установлен автоматически вместе с EasySEF, но не опубликован по умолчанию. Вы должны опубликовать его и воспользоваться инструкциями по его настройке. </p>
        <p>И EasySEF и shCustomTags были протестированы и предназначаются только для работы с Joostina 1.3.x и JoosMart 1.0. .</p>
        <p>Большое спасибо всем разработчикам предыдущих версий 404SEF.</p>
		
 <h2>Документация</h2>
 
 <p><h4>IMPORTANT : if you plan to use mod_rewrite (.htaccess) rewriting : </h4> <span class=h5>BEFORE</span> making any attempt to activate this component and use its URL rewriting functions, <span class=h5>your Joomla installation should already be compatible with URL rewriting</span>. This is not required if you select no .htaccess rewrite mode in EasySEF advanced parameters (but this mode may not always work as well, depending on your server settings). <br /><br />Remember : if you are having difficulties with this, it is unlikely to be a joomla problem, but most likely something related to your server setup. For instance, many times, you will be faced with 404 errors or Internal server errors 500 display. This indicates that there is something in your .htacces file that is not compatible with your apache server setup.<br /><br />
If you face this kind of errors, I will suggest you contact your hosting company for assistance.  <br />
If your .htaccess is not compatible with your apache server, or hosting company, there is no point in trying to use EasySEF - or any other similar component like ARTIO Joomsef, OpenSEF or Advanced SEF - as they will simply not work. You will have first to fix your installation, paying particular attention to the existence and the content of your .htaccess file. However, one of the first thing to control : verify that mod_rewrite is loaded by PHP. To do this, in Joomla backend, go to System menu, then System information. On the PHP tab, just run a search for the word 'rewrite'. If you don't find anything, then mod_rewrite is not loaded and nothing will work. You need to change your Apache web server httpd.conf file, or contact your system administrator or shared host company to do this for you.</p>

<p>In a few words on .htaccess :</p>
<ul>
<li>Joomla standard .htaccess is very <span class=h5>FINE</span>. It will work with most hosting companies. You should use it unmodified, at least to start with. Just remember it comes named as htaccess.txt, so you need to <span class=h5>rename</span> it to .htaccess before anything.</li>
<li>Joomla standard .htaccess comes configured for Joomla standard SEF system (which makes sense!). To use it with EasySEF (or OpenSEF, Artio JoomSEF, SEF Advance), you must open it up in an editor, and make the few changes explained in it:<br />
If you scroll down towards the end of the file, you'll see two sections, one marked <span class=h5>Begin - Joomla! core SEF Section</span>, and just next to it another marked : <span class=h5>########## Begin - 3rd Party SEF Section</span><br />
Now the tricky part : you should type # at the beginning of each line of the first section, and remove those # in front of those in the second section, so that the whole things looks like :<br /><br />
<i>########## Begin - Joomla! core SEF Section<br />
############# Use this section if using ONLY Joomla! core SEF<br />
## ALL (RewriteCond) lines in this section are only required if you actually<br />
## have directories named 'content' or 'component' on your server<br />
## If you do not have directories with these names, comment them out.<br />
#<br />
#RewriteCond %{REQUEST_FILENAME} !-f<br />
#RewriteCond %{REQUEST_FILENAME} !-d<br />
#RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] 		##optional - see notes##<br />
#RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$  [NC]<br />
#RewriteRule ^(content/|component/) index.php<br />
#<br />
########## End - Joomla! core SEF Section<br />
<br />
<br />

########## Begin - 3rd Party SEF Section<br />
############# Use this section if you are using a 3rd party (Non Joomla! core) SEF extension - e.g. OpenSEF, 404_SEF, 404SEFx, SEF Advance, etc<br />
#<br />
RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] 		##optional - see notes##<br />
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$  [NC]<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule (.*) index.php<br />
#<br />
########## End - 3rd Party SEF Section</i><br />
<br />
Note : this is from the .htaccess that comes with Joomla 1.0.12. If you are using a more recent version of Joomla, in the 1.0.x series, use the latest version of the file instead of this one.<br />
<br />
</li>
<li>If you get 404 errors or Internal error 500, or similar, when clicking on a rewritten URL, then you should try adding another # at the beginning of this line (near the top of the file): <br /><br />
Options FollowSymLinks <br /><br />
so that it looks like: <br /><br />
#Options FollowSymLinks <br /><br />
</li>
<li>If that does not work, and if your Joomla site is in a sub-directory, you should look for the line that looks like: <br />
#RewriteBase /<br />
and replace it with : 
RewriteBase /sub_directory_of_your_joomla_install<br />
</li>
<li>On some servers, even if your site is not in a sub-directory, you may want to try replacing<br />
#RewriteBase /<br />
by <br />
RewriteBase /<br />
</li>
<li>One little thing more : try changing only one thing at a time, and check the result before moving to next step</li>
</ul> 
    <ol style="list-style-type: upper-roman;">
        <li>
            <h3>Introduction</h3>
            <p>Here are the main information bits required to use EasySEF. You can view this documentation again by selecting the 'EasySEF Documentation' button from the EasySEF Control Panel.</p>
            <p>Please note that I cannot support IIS installation in any way. EasySEF may well work on such machines, but it is not tested at all.</p>
        </li>
        <li>
            <h3>Installation Instructions</h3>
            <p>You can view installation instructions below by clicking the appropriate
                arrow.</p>
            <ol style="list-style-type: decimal;" id="collapsibleList">
                <li>
                    <script type="text/javascript">
					document.writeln('<img id="imgInstall" src="components/com_sef/images/up.png" width="15" height="8" alt="Open list" onClick="toggle(\'imgInstall\',\'install\');">');
				</script>
                    <span class="h4">Installation</span><br />
                    <ul id="install" style="list-style: none;">
                        <li>
                            <ol>
                                <li>Upload the zip file to Joomla using
                                    the component installer in the usual way.</li>
                                <li>For apache, the .htaccess file that comes with Joomla is FINE!!<br />
                                There is just one line I would suggest you add to it: <br />
                                # Rule for duplicate content removal : www.domain.com vs domain.com<br />
RewriteCond %{HTTP_HOST} ^mydomain\.com [NC]<br />
RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L,NC]<br />
What this will do is rewrite all page requests starting with mydomain.com to www.mydomain.com. This way, you will avoid some duplicate contents issues (even though that is not really a problem nowadays, at least with Google), and also improve the way many editors, including JCE, will behave.<br />
You should <span class=h5>replace mydomain\.com on the first line and www.mydomain.com by your own domain information of course</span>. <br />
Also, you should place these 3 lines just after the RewriteBase line in Joomla standard .htaccess file.<br />
Lastly, you can also do it the other way around, that is rewrite www.mydomain.com to mydomain.com. To do this, simply use :<br />
# Rule for duplicate content removal : domain.com vs wwwdomain.com<br />
RewriteCond %{HTTP_HOST} ^www.mydomain\.com [NC]<br />
RewriteRule (.*) http://mydomain.com/$1 [R=301,L,NC]<br />
<br />
                                </li>
                                <li>For IIS, see Configuring IIS..</li>
                                <li>Ensure that SEF is enabled under Global Configuration
                                    in the Joomla backend.</li>
                                <li> Edit the 404 SEF configuration, Change Enable
                                    to yes and save.<br />
                                    This is neccessary to ensure the default
                                    404 document gets saved to the Joomla
                                    database. </li>
                            </ol>
                        </li>
                    </ul>
                </li>
                <li>
                    <script type="text/javascript">document.writeln('<img id="imgIIS" src="components/com_sef/images/up.png" width="15" height="8" alt="Open list" onClick="toggle(\'imgIIS\',\'iis\');">');
				</script>
                    <span class="h4">Configuring IIS</span><br />
                    <br />
                   
                    <ul id="iis" style="list-style: none">
                        <li> <span class=h5>IMPORTANT</span> : The instructions below are provided as is, with no warranty. They are simply copied over from past version of 404SEFx, and I have absolutely no idea if they are correct or not. Please not that good results have been reported using the "no .htaccess (/index.php/)" operating mode of EasySEF instead of trying to setup a rewriting engine in IIS. If you use this operating mode, you don"t need anything than just EasySEF. However, again, IIS may have been configured in a way where even this mode cannot work, so please report to EasySEF support forum, or to Joomla Forum for assistance in setting this up.<br />
                    <br />
                            <ol>
                                <li>
                                    <h4>Install ActiveScript</h4>
                                    After installing PHP, you should download
                                    the ActiveScript DLL (php4activescript.dll)
                                    and place it in the main PHP folder (e.g.
                                    C:\php).<br/>
                                    <br/>
                                    After having all the files needed, you must
                                    register the DLL on your system. To achieve
                                    this, open a Command Prompt window (located
                                    in the Start Menu). Then go to your PHP directory
                                    by typing something like cd C:\php. To register
                                    the DLL just type
                                    <pre>regsvr32 php4activescript.dll</pre>
                                </li>
                                <li>
                                    <h4>Install .NET framework 1.1</h4>
                                    To the best of my limited knowledge of IIS,
                                    this is required for web.config to work,
                                    so install it<br/>
                                    <br/>
                                </li>
                                <li>
                                    <h4>Create/Modify web.config</h4>
                                    <span style="color: red; font-weight: bold;">NOTE:
                                    in the example below, Joomla/Mambo is installed
                                    in the virtual directory 'joomla'.</span><br/>
                                    <br/>
                                    Create C:\Inetpub\wwwroot\web.config and
                                    add the content below:<br />
                                    <pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
        &lt;configuration&gt;
        	&lt;system.web&gt;
        		&lt;compilation defaultLanguage=&quot;PHP4Script&quot; debug=&quot;true&quot; /&gt;
        		&lt;customerrors mode=&quot;On&quot; defaultRedirect=&quot;/joomla/index.php&quot; /&gt;
        	&lt;/system.web&gt;
        &lt;/configuration&gt;</pre>
                                </li>
                                <li>
                                    <h4>Configure the Custom Errors</h4>
                                    <span style="color: red; font-weight: bold;">NOTE:
                                    in the example below, Joomla/Mambo is installed
                                    in the virtual directory Joomla</span>
                                    <pre>Using the Internet Services Manager, right-click the directory in which Joomla is installed.
							Select properties >> Custom Error
							set the 404 to URL:/mambo/index.php
							set the 405 to URL:/mambo/index.php</pre>
                                </li>
                            </ol>
                        </li>
                    </ul>
                </li>
                <li>
                    <script type="text/javascript">document.writeln('<img id="imgUninstall" src="components/com_sef/images/up.png" width="15" height="8" alt="Open list" onClick="toggle(\'imgUninstall\',\'uninstall\');">');
				</script>
                    <span class="h4">Uninstall</span><br />
                    <ul id="uninstall" style="list-style: none;">
                        <li>
                            <ol>
                                <li>Uninstall the component using the component
                                    unistaller in the usual way.</li>
                                </li>
                                <li>For IIS, remove C:\Inetpub\wwwroot\web.config
                                    and<br />
                                    the Custom Errors you created with the Internet
                                    Services Manager<br />
                                </li>
                            </ol>
                        </li>
                    </ul>
                </li>
            </ol>
        </li>
        <li>
            <h3>Useful Tips For Using EasySEF</h3>
            <ul style="list-style: none;">
            <li>
            <h4>Configuration</h4>
            
            <p>Using EasySEF configuration is fairly straightforward for most of it.
                For more information on each item hover your mouse over the blue
                (i) images when you are in the configuration screen.</p>
            <p>When you save the configuration it will remove all your URL's
                from the database. If you have a high traffic site it may be
                wise to put it offline before saving EasySEF config
                or purging the database. <span class=h5>After doing that, you should use an
                online tool to build automatically a sitemap</span>. The side effect
                of doing this is that this software will go through all of 
                your site, and therefore all of your links, so they will be
                all automatically placed in the cache, thus speeding access for your next visitors.<br>
                The caching system of EasySEF is transparent,and will be rebuild automatically whenever
                required. Using the cache will
                vastly speed up the page load time, by dramatically reducing 
                the number of database queries. Beware that URL caching uses 
                up a lot of memory though. Its size can be limited using the appropriate parameter, and it can also be turned off completely.
                <span class=h5>I estimate that 10 000 URLs eats up around 2 Mb, but that is per visitor to your site.</span></p>
                <p>Well, 10 000 URLs, that's already a sizable site!</p>
                <p></p>
                <p>If you have a multi-lingual site, you can turn on or off URL translation. Normally, URL elements will be translated into the user language. However, it sometimes better not to translate, such as when using non-latin characters based languages. On such occasions, default site language will always be used/p>
                <p></p>
                
            <p>You may want to purge the 404 log before creating fresh urls.</p>
            </li>
            <li>
            <h4>Modifying URL's</h4>
            <p>You can modify URL's to your liking. Go into EasySEF
                Control Panel and click ' View/Edit SEF Urls'. Select the URL
                you wish to modify. If you click the check box labeled 'Save
                as Custom Redirect' it will place this URL into the 'Custom Redirect'
                area which you can navigate to from the EasySEF Control
                Panel. When you click 'View/Edit Custom Redirects' you will see
                your URL in here now instead. These urls will not be removed
                when you save the config. You can modify these and save them
                as you wish.
            <p>This is particularly useful if you are updating from an old site
                because any URL's that are no longer availble will be logged.
                You can view these URL's by clicking 'View/Edit 404 Logs' in
                the EasySEF Control Panel. You can redirect visitors to
                the new page by selecting the URL you wish to modify and entering
                the new url.</p>
            </li>
            <li>
            <h4>Backing up your data</h4>
            <p>You can import and export your URL to a text file, using the corresponding button on EasySEF control panel.</p>
            <p>You can also import and export URL's from the Custom Redirect area. In this case, only the manually defined URL will stored in the export file. </p>
            <p>The import file is a simple text file, where URL are listed in rows. This is well suited to be imported into a spreadsheet software if some heavy text processing is to be done on redirections for instance</p>
            <p>If you want to import back your urls, go to the same screen,  browse to the file and click the
                'Import Custom URLS' button.</p>
             <p>Manually defined meta tags can be exported/imported in very much the same way. The export/import link is located at the top of the Meta Tags screen, accessed from the main control panel</p>   
                </ul>
            </li>
        </li>
    </ol>       
	
	<h2>Joomfish</h2>
	<p>Special note for Joomfish 1.7 users : it is usually more handy to use content elements Alias in URL, instead of Title. However, Aliase are not translated by Joomfish, as per default settings. <br />To have alias translated as well :</p>
<br />
      Locate and open administrator/components/com_joomfish/contentelements/content.xml<br />
      Find the line that looks like :<br />
      &lt;field type=&quot;text&quot; name=&quot;title_alias&quot; translate=&quot;0&quot;&gt;Title Alias&lt;/field&gt;<br />
      and change it to <br />
      &lt;field type=&quot;text&quot; name=&quot;title_alias&quot; translate=&quot;<span class=h5>1</span>&quot;&gt;Title Alias&lt;/field&gt;<br />
	
	<h2>Virtuemart</h2>
	<p>Special note for Virtuemart users: This component has only been tested with Virtuemart 1.0.10 (as of date of this release).</p>
<h4>There is a bug in VM 1.0.10 with respect to Joomfish</h4><span class=h5>see topic #26943 on VirtueMart forum</span>.
	<p><span class=h5>File : /components/com_virtuemart/virtuemart_parser.php</span></p>
  
  <span class=h5>line 40</span>: insert code, so that result is as follow :<br /><br />
  $option = mosGetParam( $_REQUEST, 'option' );<br />
<br />
// shumisha fix for Joomfish, as per post on forum topic = 26943.0<br />
global $mosConfig_lang;<br />
$jFishLang = $mosConfig_lang;<br />
// end of fix<br />
<br />
if( !defined( '_VM_PARSER_LOADED' )) {<br />
<br />
  <span class=h5>line 60</span> : insert code, so that result is as follow :<br /><br />
  // the configuration file for the Shop<br />
	require_once( $mosConfig_absolute_path. "/administrator/components/com_virtuemart/virtuemart.cfg.php" );<br />

  // fix for Joomfish, as per post on forum topic = 26943.0<br />
  $mosConfig_lang = $jFishLang;<br />
  // end of fix<br />
	// The abstract language class<br />
	require_once( CLASSPATH."language.class.php" );	<br /><br />

<h4>Joomla hack to allow SSL operation with Virtuemart (and others as well)</h4>
<br />
    Find and open file : /includes/joomla.php<br />
    Locate the text : function sessionCookieName(). Replace the next lines to make it as follows:<br />
   <br /> 
	function sessionCookieName() {<br />
		global $mainframe;<br />
<br />
		//return md5( 'site' . $mainframe->getCfg( 'live_site' ) );<br />
		// shumisha : found at http://www.netshinesoftware.com/security/using-an-ssl-certificate-with-your-joomla-website.html<br />
		return md5( 'site' . str_replace('http://', '', str_replace('https://', '', $mainframe->getCfg( 'live_site' ))) );<br />
	}<br />
<br />
<br />
    
    <script type="text/javascript">
		document.getElementById('collapsibleList').style.listStyle="none"; // remove list markers
		document.getElementById('install').style.display="none"; // collapse list
		document.getElementById('iis').style.display="none"; // collapse list
		document.getElementById('uninstall').style.display="none"; // collapse list
		// this function toggles the status of a list
		function toggle(image,list){
			var listElementStyle=document.getElementById(list).style;
			if (listElementStyle.display=="none"){
				listElementStyle.display="block"; document.getElementById(image).src="components/com_sef/images/down.png";
				document.getElementById(image).alt="Close list";
			}
			else{
				listElementStyle.display="none";
				document.getElementById(image).src="components/com_sef/images/up.png";
				document.getElementById(image).alt="Open list";
			}
		}
	</script>
    <div class="small" style="text-align: center;">
        Copyright &copy; 2010 <a href="http://sitelab.net.ru" target="_blank">Лаборатория сайтов</a><br />
         Распространяется в соответствии с условиями GNU General Public License.
    </div>
</div>
